import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '编号',
    align: 'center',
    dataIndex: 'code',
  },
  {
    title: 'cycle',
    align: 'center',
    dataIndex: 'cycle',
  },
  {
    title: '开始时间',
    align: 'center',
    dataIndex: 'startTime',
  },
  {
    title: '结束时间',
    align: 'center',
    dataIndex: 'endTime',
  },
  {
    title: 'expenseNum',
    align: 'center',
    dataIndex: 'expenseNum',
  },
  {
    title: '新手任务',
    align: 'center',
    dataIndex: 'isNewbie',
  },
  {
    title: '项目图片',
    align: 'center',
    dataIndex: 'img',
  },
  //  {
  //   title: '项目描述',
  //   align:"center",
  //   dataIndex: 'remark'
  //  },
  {
    title: 'dayNum',
    align: 'center',
    dataIndex: 'dayNum',
  },
  {
    title: '项目类型',
    align: 'center',
    dataIndex: 'proType',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '编号',
    field: 'code',
    component: 'Input',
  },
  {
    label: 'cycle',
    field: 'cycle',
    component: 'InputNumber',
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '消费金币',
    field: 'expenseNum',
    component: 'InputNumber',
  },
  {
    label: '新手项目',
    field: 'isNewbie',
    component: 'InputNumber',
  },
  {
    label: '项目图片',
    field: 'img',
    component: 'JImageUpload',
    componentProps: {
      fileMax : 1,
    },
  },
  {
    label: '项目描述',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: '项目周期',
    field: 'dayNum',
    component: 'InputNumber',
  },
  {
    label: '项目分类',
    field: 'proType',
    component: 'Select',
    componentProps: {
      options: [
        { label: '精品项目', value: 0 },
        { label: '热门项目', value: 1 },
      ],
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: { title: 'name', order: 0, view: 'text', type: 'string' },
  code: { title: 'code', order: 1, view: 'text', type: 'string' },
  cycle: { title: 'cycle', order: 2, view: 'number', type: 'number' },
  startTime: { title: 'startTime', order: 3, view: 'datetime', type: 'string' },
  endTime: { title: 'endTime', order: 4, view: 'datetime', type: 'string' },
  expenseNum: { title: 'expenseNum', order: 5, view: 'number', type: 'number' },
  isNewbie: { title: 'isNewbie', order: 6, view: 'number', type: 'number' },
  img: { title: 'img', order: 7, view: 'text', type: 'string' },
  remark: { title: 'remark', order: 8, view: 'textarea', type: 'string' },
  dayNum: { title: 'dayNum', order: 9, view: 'number', type: 'number' },
  proType: { title: 'proType', order: 10, view: 'number', type: 'number' },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}